package com.fzshang.commen.serviceImpl;

import com.fzshang.commen.bean.AttributeClassification;
import com.fzshang.commen.bean.User;
import com.fzshang.commen.bean.layuiBean.ResultPage;
import com.fzshang.commen.bean.layuiBean.VoPage;
import com.fzshang.commen.mapper.AttributeClassificationMapper;
import com.fzshang.commen.service.AttributeClassificationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 属性分类 服务实现类
 * </p>
 *
 * @author 冯政尚
 * @since 2020-02-01
 */
@Service
public class AttributeClassificationServiceImpl extends ServiceImpl<AttributeClassificationMapper, AttributeClassification> implements AttributeClassificationService {


    /**
     * @param voPage
     * @return 后台查询
     */
    @Override
    public ResultPage<AttributeClassification> selectMyPage(VoPage voPage, AttributeClassification attributeClassification) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("page", (voPage.getPage() - 1) * voPage.getLimit());
        paramMap.put("limit", voPage.getLimit());
        paramMap.put("attributeClassification", attributeClassification.getAttributeClassification());
        List<AttributeClassification> list = baseMapper.selectMyPage(paramMap);
        Integer count = baseMapper.countMyPage(paramMap);
        ResultPage<AttributeClassification> resultPage = new ResultPage<>();
        resultPage.setCode(0);
        resultPage.setCount(count);
        resultPage.setMsg("成功");
        resultPage.setData(list);
        return resultPage;
    }


}
